<?php 
ob_start();
session_start();
//echo $_SESSION['fb_user_id']; exit;
		$finalstatusByDecision='pass'; 
		
		if(!isset($_POST['AgreePrivacyCredit']) || empty($_POST['AgreePrivacyCredit'])) 
			$mc_agreement = NULL; 
		else
			$mc_agreement = $_POST['AgreePrivacyCredit']; 

		if(!isset($_POST['browser']) || empty($_POST['browser']))
			$mc_browser =  NULL;
		else
			$mc_browser = $_POST['browser'];

		if(!isset($_POST['OtherPurpose']) || empty($_POST['OtherPurpose']))
			$mc_OtherPurpose = NULL;  
		else
			$mc_OtherPurpose = $_POST['OtherPurpose'];

		if(!isset($_POST['ipaddress']) || empty($_POST['ipaddress']))
			$mc_ipaddress = NULL;
		else
			$mc_ipaddress = $_POST['ipaddress'];
					
		if(!isset($_POST['LoanAmount']) || empty($_POST['LoanAmount']))
			$loanamount = NULL;
		else
			$loanamount = $_POST['LoanAmount'];
			
		if(!isset($_POST['due_month']) || empty($_POST['due_month']))
			$term = NULL;
		else
			$term = $_POST['due_month'];

		if(!isset($_POST['Title1']) || empty($_POST['Title1']))
			$title = NULL;
		else
			$title = $_POST['Title1'];
			
		if(!isset($_POST['FirstName1']) || empty($_POST['FirstName1']))
			$firstname = NULL;
		else
			$firstname = $_POST['FirstName1'];
			
		if(!isset($_POST['MiddleName1']) || empty($_POST['MiddleName1']))
			$middlename = NULL;
		else  
			$middlename = $_POST['MiddleName1'];
			
		if(!isset($_POST['Surname1']) || empty($_POST['Surname1']))
			$surname = NULL;
		else
			$surname = $_POST['Surname1'];
			
		if(!isset($_POST['Residency1']) || empty($_POST['Residency1']))
			$citizenship = NULL;
		else
			$citizenship = $_POST['Residency1'];
			
		if(!isset($_POST['DateOfBirth']) || empty($_POST['DateOfBirth']))
			$dateofbirth = NULL;
		else
			$dateofbirth = $_POST['DateOfBirth'];
			
		if(!isset($_POST['ResidentialAddress1']) || empty($_POST['ResidentialAddress1']))
			$residentialaddress = NULL;
		else
			$residentialaddress = $_POST['ResidentialAddress1'];
			$ResidentialAddress1 = $_POST['ResidentialAddress1'];
			$array=explode(",",$ResidentialAddress1);
			$ResidentialAddress1=$array[0];
			if(is_numeric($ResidentialAddress1[0])){
			$streetNo1 = explode(" ",$ResidentialAddress1);
			$streetNo1 = $streetNo1[0];
			$ResidentialAddress1 = str_replace($streetNo1,"",$ResidentialAddress1);
			}
			
			
			
			
		if(!isset($_POST['Number1']) || empty($_POST['Number1']))
			$streetnumber = NULL;
		else
			$streetnumber = $_POST['Number1'];
			
		if(!isset($_POST['Street1']) || empty($_POST['Street1']))
			$street = NULL;
		else
			$street = $_POST['Street1'];
		
		if(!isset($_POST['StreetType1']) || empty($_POST['StreetType1']))
			$streettype = NULL;
		else
			$streettype = $_POST['StreetType1'];
		
		if(!isset($_POST['Suburb1']) || empty($_POST['Suburb1']))
			$suburb = NULL;
		else
			$suburb = $_POST['Suburb1'];
				
		if(!isset($_POST['State1']) || empty($_POST['State1']))
			$state = NULL;
		else
			$state = $_POST['State1'];

		if(!isset($_POST['Postcode1']) || empty($_POST['Postcode1']))
			$postcode = NULL;
		else
			$postcode = $_POST['Postcode1'];
			
		if(!isset($_POST['Mobile1']) || empty($_POST['Mobile1']))
			$mobile = NULL;
		else
			$mobile = $_POST['Mobile1'];
			
		if(!isset($_POST['Phone1']) || empty($_POST['Phone1']))
			$phone = NULL;
		else
			$phone = $_POST['Phone1'];
			
		if(!isset($_POST['EMailAddress1']) || empty($_POST['EMailAddress1']))
			$emailaddress = NULL;
		else
			$emailaddress = $_POST['EMailAddress1'];
			
		if(!isset($_POST['TypeOfEmployment1']) || empty($_POST['TypeOfEmployment1']))
			$typeofemployment = NULL;
		else
			$typeofemployment = $_POST['TypeOfEmployment1'];
			
		if(!isset($_POST['TitleInOccupation1']) || empty($_POST['TitleInOccupation1']))
			$titleinoccupation = NULL;
		else
			$titleinoccupation = $_POST['TitleInOccupation1'];
			
		if(!isset($_POST['BusinessName1']) || empty($_POST['BusinessName1']))
			$businessname = NULL;
		else
			$businessname = $_POST['BusinessName1'];
			
		if(!isset($_POST['WorkPhone1']) || empty($_POST['WorkPhone1']))
			$workphone = NULL;
		else
			$workphone = $_POST['WorkPhone1'];
		
		if(!isset($_POST['NumberofDependant1']) || empty($_POST['NumberofDependant1']))
			$numberofdependant = NULL;
		else
			$numberofdependant = $_POST['NumberofDependant1'];
			
		if(!isset($_POST['IncomeAfterTax1']) || empty($_POST['IncomeAfterTax1']))
			$incomeaftertax = NULL;
		else
			$incomeaftertax = $_POST['IncomeAfterTax1'];
			
		if(!isset($_POST['IncomeAfterTax1Period']) || empty($_POST['IncomeAfterTax1Period']))
			$incomeaftertax1period = NULL;
		else
			$incomeaftertax1period = $_POST['IncomeAfterTax1Period'];
			
		if(!isset($_POST['Hardship1']) || empty($_POST['Hardship1']))
			$hardship = NULL;
		else
			$hardship = $_POST['Hardship1'];
		
		if(!isset($_POST['Gambling1']) || empty($_POST['Gambling1']))
			$Gambling = NULL;
		else
			$Gambling = $_POST['Gambling1'];	
			
		if(!isset($_POST['loanInLastTwoMonth']) || empty($_POST['loanInLastTwoMonth']))
			$loaninlasttwomonth = NULL;
		else
			$loaninlasttwomonth = $_POST['loanInLastTwoMonth'];
			
		if(!isset($_POST['CreditHistory1']) || empty($_POST['CreditHistory1']))
			$credithistory = NULL;
		else
			$credithistory = $_POST['CreditHistory1'];
			
		if(!isset($_POST['totalOutstanding1']) || empty($_POST['totalOutstanding1']))
			$totaloutstanding = NULL;
		else
			$totaloutstanding = $_POST['totalOutstanding1'];
		
		if(!isset($_POST['DateOfDischarge1']) || empty($_POST['DateOfDischarge1']))
			$dateofdischarge = NULL;
		else
			$dateofdischarge = $_POST['DateOfDischarge1'];
	
		if(!isset($_POST['DefaultAfterDischarge1']) || empty($_POST['DefaultAfterDischarge1']))
			$defaultafterdischarge = NULL;
		else
			$defaultafterdischarge = $_POST['DefaultAfterDischarge1'];
		
		if(!isset($_POST['WhyChooseMF']) || empty($_POST['WhyChooseMF']))
			$whychoosemf = NULL;
		else
			$whychoosemf = $_POST['WhyChooseMF'];
		
		if(!isset($_POST['ExistingClient']) || empty($_POST['ExistingClient']))
			$existingclient = NULL;
		else
			$existingclient = $_POST['ExistingClient'];
		
		if(!isset($_POST['Liabilities']['LoanRepayment']['payment']) || empty($_POST['Liabilities']['LoanRepayment']['payment']))
			$liabilitiesloanrepaymentpayment = NULL;
		else
			$liabilitiesloanrepaymentpayment = $_POST['Liabilities']['LoanRepayment']['payment'];
			
		if(!isset($_POST['LoanRepaymentPeriod']) || empty($_POST['LoanRepaymentPeriod']))
			$loanrepaymentperiod = NULL;
		else
			$loanrepaymentperiod = $_POST['LoanRepaymentPeriod'];
			
		if(!isset($_POST['Liabilities']['CreditCard']['payment']) || empty($_POST['Liabilities']['CreditCard']['payment']))
			$liabilitiescreditcardpayment = NULL;
		else
			$liabilitiescreditcardpayment = $_POST['Liabilities']['CreditCard']['payment'];
			
		if(!isset($_POST['CreditCardPaymentPeriod']) || empty($_POST['CreditCardPaymentPeriod']))
			$creditcardpaymentperiod = NULL;
		else
			$creditcardpaymentperiod = $_POST['CreditCardPaymentPeriod'];
			
		if(!isset($_POST['Liabilities']['BoardingRentingFee']['payment']) || empty($_POST['Liabilities']['BoardingRentingFee']['payment']))
			$liabilitiesboardingrentingfeepayment = NULL;
		else
			$liabilitiesboardingrentingfeepayment = $_POST['Liabilities']['BoardingRentingFee']['payment'];
			
		if(!isset($_POST['BoardingRentingPeriod']) || empty($_POST['BoardingRentingPeriod']))
			$boardingrentingperiod = NULL;
		else
			$boardingrentingperiod = $_POST['BoardingRentingPeriod'];
			
		if(!isset($_POST['Liabilities']['LivingExpenses']['payment']) || empty($_POST['Liabilities']['LivingExpenses']['payment']))
			$liabilitieslivingexpensespayment = NULL;
		else
			$liabilitieslivingexpensespayment = $_POST['Liabilities']['LivingExpenses']['payment'];
			
		if(!isset($_POST['LivingExpensesPeriod']) || empty($_POST['LivingExpensesPeriod']))
			$livingexpensesperiod = NULL;
		else
			$livingexpensesperiod = $_POST['LivingExpensesPeriod'];
			
		if(!isset($_POST['LengthOfResidenceYear1']) || empty($_POST['LengthOfResidenceYear1']))
			$residenceperiod = NULL;
		else
			$residenceperiod = $_POST['LengthOfResidenceYear1'];
			
		if(!isset($_POST['PurposeOfLoan1']) || empty($_POST['PurposeOfLoan1']))
			$purposeofloan = NULL;
		else
			$purposeofloan = $_POST['PurposeOfLoan1'];
			
		if(!isset($_POST['loginpassword']) || empty($_POST['loginpassword']))
			$loginpassword = NULL;
		else
			$loginpassword = $_POST['loginpassword'];
		
		if(!isset($_POST['ResidentialStatus1']) || empty($_POST['ResidentialStatus1']))
			$residentialstatus = NULL;
		else
			$residentialstatus = $_POST['ResidentialStatus1'];
			
		//echo "the residentialstatus is".$residentialstatus."<br>";	
		 
		 if(isset($_SESSION['fb_user_id']) && $_SESSION['fb_user_id'] != 0) {
				echo $_SESSION['fb_user_id'];
		 }
				 
		 include("applynowinsert.php");	
ob_flush();
?>		 